
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>Mininet · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="../../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-search-pro/search.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-flexible-alerts/style.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../../styles/website.css">
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="wireshark.html" />
    
    
    <link rel="prev" href="vscode.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../../">
            
                <a href="../../">
            
                    
                    Computer Network Lab Manual
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="lab-1.html">
            
                <a href="lab-1.html">
            
                    
                    Lab 1: Switchyard & Mininet
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="prerequisites.html">
            
                <a href="prerequisites.html">
            
                    
                    Task 1: Prerequisites
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1.1" data-path="linux.html">
            
                <a href="linux.html">
            
                    
                    Linux
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.2" data-path="python.html">
            
                <a href="python.html">
            
                    
                    Python
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.1.3" data-path="git.html">
            
                <a href="git.html">
            
                    
                    Git
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="workflow.html">
            
                <a href="workflow.html">
            
                    
                    Task 2: Workflow
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.2.1" data-path="vscode.html">
            
                <a href="vscode.html">
            
                    
                    VS Code
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2.2.2" data-path="mininet.html">
            
                <a href="mininet.html">
            
                    
                    Mininet
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.3" data-path="wireshark.html">
            
                <a href="wireshark.html">
            
                    
                    Wireshark
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2.4" data-path="switchyard.html">
            
                <a href="switchyard.html">
            
                    
                    Switchyard
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="nju-gitlab.html">
            
                <a href="nju-gitlab.html">
            
                    
                    Task 3: NJU GitLab
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="modification.html">
            
                <a href="modification.html">
            
                    
                    Task 4: Modification
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../ch02/lab-2.html">
            
                <a href="../ch02/lab-2.html">
            
                    
                    Lab 2: Learning Switch
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../ch02/preparation.html">
            
                <a href="../ch02/preparation.html">
            
                    
                    Task 1: Preparation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../ch02/basic-switch.html">
            
                <a href="../ch02/basic-switch.html">
            
                    
                    Task 2: Basic Switch
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../ch02/timeouts.html">
            
                <a href="../ch02/timeouts.html">
            
                    
                    Task 3: Timeouts
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../ch02/lru.html">
            
                <a href="../ch02/lru.html">
            
                    
                    Task 4: Least Recently Used
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../ch02/ltv.html">
            
                <a href="../ch02/ltv.html">
            
                    
                    Task 5: Least Traffic Volume
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../ch02/faq.html">
            
                <a href="../ch02/faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../ch03/ipv4-router.html">
            
                <a href="../ch03/ipv4-router.html">
            
                    
                    Lab 3-5: IPv4 Router
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../ch03/subch01/lab-3.html">
            
                <a href="../ch03/subch01/lab-3.html">
            
                    
                    Lab 3: Respond to ARP
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1.1" data-path="../ch03/subch01/preparation.html">
            
                <a href="../ch03/subch01/preparation.html">
            
                    
                    Task 1: Preparation
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.2" data-path="../ch03/subch01/handle-arp-request.html">
            
                <a href="../ch03/subch01/handle-arp-request.html">
            
                    
                    Task 2: Handle ARP Request
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4.1.3" data-path="../ch03/subch01/arp-table.html">
            
                <a href="../ch03/subch01/arp-table.html">
            
                    
                    Task 3: Cached ARP Table
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="../ch03/faq.html">
            
                <a href="../ch03/faq.html">
            
                    
                    FAQ
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="../../appendix/appendix.html">
            
                <a href="../../appendix/appendix.html">
            
                    
                    Appendix
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="../../appendix/environment-setup.html">
            
                <a href="../../appendix/environment-setup.html">
            
                    
                    Environment Setup
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="../../appendix/about-this-repository.html">
            
                <a href="../../appendix/about-this-repository.html">
            
                    
                    About This Repository
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../.." >Mininet</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="mininet"><a name="mininet" class="plugin-anchor" href="#mininet"><i class="fa fa-link" aria-hidden="true"></i></a>Mininet</h1>
<p>Mininet enables you to quickly create, interact with, customize and share a software defined network prototype, and provides a smooth path to running on hardware.</p>
<p>The most useful material is their website. Here is the <a href="http://mininet.org/walkthrough/" target="_blank">Mininet Walkthrough</a>. At this stage you will encounter some concepts you are not familiar with such as switches and hosts, but remember to come back after you have learned them. In this section, we will have a small practice of Mininet.</p>
<blockquote>
<p>[!NOTE]
Ignore the content about switches like Open vSwitch (OVS) setting up.</p>
</blockquote>
<p>We expect that you will spend 2 days on this.</p>
<h2 id="install-mininet"><a name="install-mininet" class="plugin-anchor" href="#install-mininet"><i class="fa fa-link" aria-hidden="true"></i></a>Install Mininet</h2>
<p>If you find that Mininet is not installed on your system, run this command to install it.</p>
<pre><code>$ sudo apt-get install mininet
</code></pre><p>Or you want to build mininet yourself. The installation guide is <a href="http://mininet.org/download/" target="_blank">here</a>.</p>
<h2 id="install-xterm"><a name="install-xterm" class="plugin-anchor" href="#install-xterm"><i class="fa fa-link" aria-hidden="true"></i></a>Install Xterm</h2>
<p>If you find that Xterm is not installed on your system, run this command to install it.</p>
<pre><code>$ sudo apt-get install xterm
</code></pre><h2 id="everyday-mininet-usage"><a name="everyday-mininet-usage" class="plugin-anchor" href="#everyday-mininet-usage"><i class="fa fa-link" aria-hidden="true"></i></a>Everyday Mininet Usage</h2>
<p>First, a (perhaps obvious) note on command syntax for this walkthrough:</p>
<ul>
<li><code>$</code> proceeds Linux commands that should be typed at the shell prompt</li>
<li><code>mininet&gt;</code> proceeds Mininet commands that should be typed at Mininet&#x2019;s CLI,</li>
<li><code>#</code> proceeds Linux commands that are typed at a root shell prompt</li>
</ul>
<h3 id="start-mininet"><a name="start-mininet" class="plugin-anchor" href="#start-mininet"><i class="fa fa-link" aria-hidden="true"></i></a>Start Mininet</h3>
<p>So let&apos;s start with Mininet startup options. Type the following command to display a help message. Read the output for more usages of Mininet.</p>
<pre><code>$ sudo mn -h
</code></pre><blockquote>
<p>[!WARNING|style:flat]
Commands start with <code>sudo</code> or run as a superuser (prompt like <code>#</code>) are dangerous. Avoid doing things like that. But you need run Mininet as a superuser so be careful.</p>
</blockquote>
<p>Then let&apos;s build a Mininet default topology.</p>
<pre><code>$ sudo mn
</code></pre><p><img src="assets/shell.png" alt="shell"></p>
<p>You will see the same output as the picture above. See what Mininet tells us. The default topology contains two hosts and one switch. They link like this</p>
<pre><code>h1 --- s1 --- h2
</code></pre><p>And you now are in Mininet CLI starts with <code>mininet&gt;</code>. The next thing is to interact with Hosts. Keep this open and let&apos;s go to the next subsection.</p>
<h3 id="interact-with-hosts"><a name="interact-with-hosts" class="plugin-anchor" href="#interact-with-hosts"><i class="fa fa-link" aria-hidden="true"></i></a>Interact with Hosts</h3>
<p>First let&apos;s see what we can do in Mininet CLI.</p>
<pre><code>mininet&gt; help
</code></pre><p>Display nodes.</p>
<pre><code>mininet &gt; nodes
</code></pre><p>Display links.</p>
<pre><code>mininet&gt; net
</code></pre><p>Dump information about all nodes. This command is useful.</p>
<pre><code>mininet&gt; dump
</code></pre><p>You should see the switch and two hosts listed.</p>
<p>If the first string typed into the Mininet CLI is a host, switch or controller name, the command is executed on that node. Run a command on a host process.</p>
<pre><code>mininet&gt; h1 ifconfig -a
</code></pre><p>And you can start a pop-up terminal emulator in one host.</p>
<pre><code>mininet&gt; h1 xterm
</code></pre><p>The new window pops up here is the terminal emulator of <code>h1</code>. If you type <code>ifconfig -a</code> here, the output is totally the same as you type <code>h1 ifconfig -a</code> in Mininet CLI.</p>
<p><img src="assets/xterm.png" alt="xterm"></p>
<h3 id="test-connectivity-between-hosts"><a name="test-connectivity-between-hosts" class="plugin-anchor" href="#test-connectivity-between-hosts"><i class="fa fa-link" aria-hidden="true"></i></a>Test Connectivity Between Hosts</h3>
<p>Now, verify that you can ping from host 0 to host 1. You can also do it in pop-up xterm at <code>h1</code>. You will learn what <code>ping</code> is in the later lessons. Now <code>ping</code> just tells you whether two hosts is well-connected.</p>
<pre><code>mininet&gt; h1 ping -c 1 h2
</code></pre><p>An easier way to run this test is to use the Mininet CLI built-in <code>pingall</code> command, which does an all-pairs <code>ping</code>.</p>
<pre><code>mininet&gt; pingall
</code></pre><h3 id="run-a-simple-web-server-and-client"><a name="run-a-simple-web-server-and-client" class="plugin-anchor" href="#run-a-simple-web-server-and-client"><i class="fa fa-link" aria-hidden="true"></i></a>Run A Simple Web Server and Client</h3>
<p>Remember that <code>ping</code> isn&#x2019;t the only command you can run on a host! Mininet hosts can run any command or application that is available to the underlying Linux system (or VM) and its file system. You can also enter any <code>bash</code> command, including job control (<code>&amp;</code>, <code>jobs</code>, <code>kill</code>, etc..)</p>
<p>Next, try starting a simple HTTP server on h1, making a request from h2, then shutting down the web server.</p>
<pre><code>mininet&gt; h1 python -m SimpleHTTPServer 80 &amp;
mininet&gt; h2 wget -O - h1
...
mininet&gt; h1 kill %python
</code></pre><p>Exit the CLI.</p>
<pre><code>mininet&gt; exit
</code></pre><h3 id="cleanup"><a name="cleanup" class="plugin-anchor" href="#cleanup"><i class="fa fa-link" aria-hidden="true"></i></a>Cleanup</h3>
<p>If Mininet crashes for some reason, clean it up.</p>
<pre><code>$ sudo mn -c
</code></pre><h2 id="custom-topologies"><a name="custom-topologies" class="plugin-anchor" href="#custom-topologies"><i class="fa fa-link" aria-hidden="true"></i></a>Custom Topologies</h2>
<p>Custom topologies can be easily defined as well, using a simple Python API. The example here connects 4 devices as a star topology shows below. This file is in the Switchyard repository <a href="https://github.com/shellqiqi/switchyard/blob/master/examples/start_mininet.py" target="_blank"><code>examples/start_mininet.py</code></a>.</p>
<pre><code class="lang-py"><span class="hljs-comment">#!/usr/bin/python</span>

<span class="hljs-keyword">import</span> sys

<span class="hljs-keyword">from</span> mininet.topo <span class="hljs-keyword">import</span> Topo
<span class="hljs-keyword">from</span> mininet.net <span class="hljs-keyword">import</span> Mininet
<span class="hljs-keyword">from</span> mininet.log <span class="hljs-keyword">import</span> lg
<span class="hljs-keyword">from</span> mininet.node <span class="hljs-keyword">import</span> CPULimitedHost
<span class="hljs-keyword">from</span> mininet.link <span class="hljs-keyword">import</span> TCLink
<span class="hljs-keyword">from</span> mininet.util <span class="hljs-keyword">import</span> irange, custom, quietRun, dumpNetConnections
<span class="hljs-keyword">from</span> mininet.cli <span class="hljs-keyword">import</span> CLI

<span class="hljs-keyword">from</span> time <span class="hljs-keyword">import</span> sleep, time
<span class="hljs-keyword">from</span> subprocess <span class="hljs-keyword">import</span> Popen, PIPE
<span class="hljs-keyword">import</span> subprocess
<span class="hljs-keyword">import</span> argparse
<span class="hljs-keyword">import</span> os

parser = argparse.ArgumentParser(description=<span class="hljs-string">&quot;Mininet pyswitch topology&quot;</span>)
<span class="hljs-comment"># no arguments needed as yet :-)</span>
args = parser.parse_args()
lg.setLogLevel(<span class="hljs-string">&apos;info&apos;</span>)

<span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">PySwitchTopo</span><span class="hljs-params">(Topo)</span>:</span>

    <span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">__init__</span><span class="hljs-params">(self, args)</span>:</span>
        <span class="hljs-comment"># Add default members to class.</span>
        super(PySwitchTopo, self).__init__()

        <span class="hljs-comment"># Host and link configuration</span>
        <span class="hljs-comment">#</span>
        <span class="hljs-comment">#</span>
        <span class="hljs-comment">#   server1 </span>
        <span class="hljs-comment">#          \</span>
        <span class="hljs-comment">#           hub----client</span>
        <span class="hljs-comment">#          /</span>
        <span class="hljs-comment">#   server2 </span>
        <span class="hljs-comment">#</span>

        nodeconfig = {<span class="hljs-string">&apos;cpu&apos;</span>:<span class="hljs-number">-1</span>}
        self.addHost(<span class="hljs-string">&apos;server1&apos;</span>, **nodeconfig)
        self.addHost(<span class="hljs-string">&apos;server2&apos;</span>, **nodeconfig)
        self.addHost(<span class="hljs-string">&apos;hub&apos;</span>, **nodeconfig)
        self.addHost(<span class="hljs-string">&apos;client&apos;</span>, **nodeconfig)

        <span class="hljs-keyword">for</span> node <span class="hljs-keyword">in</span> [<span class="hljs-string">&apos;server1&apos;</span>,<span class="hljs-string">&apos;server2&apos;</span>,<span class="hljs-string">&apos;client&apos;</span>]:
            <span class="hljs-comment"># all links are 10Mb/s, 100 millisecond prop delay</span>
            self.addLink(node, <span class="hljs-string">&apos;hub&apos;</span>, bw=<span class="hljs-number">10</span>, delay=<span class="hljs-string">&apos;100ms&apos;</span>)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_ip</span><span class="hljs-params">(net, node1, node2, ip)</span>:</span>
    node1 = net.get(node1)
    ilist = node1.connectionsTo(net.get(node2)) <span class="hljs-comment"># returns list of tuples</span>
    intf = ilist[<span class="hljs-number">0</span>]
    intf[<span class="hljs-number">0</span>].setIP(ip)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">reset_macs</span><span class="hljs-params">(net, node, macbase)</span>:</span>
    ifnum = <span class="hljs-number">1</span>
    node_object = net.get(node)
    <span class="hljs-keyword">for</span> intf <span class="hljs-keyword">in</span> node_object.intfList():
        node_object.setMAC(macbase.format(ifnum), intf)
        ifnum += <span class="hljs-number">1</span>

    <span class="hljs-keyword">for</span> intf <span class="hljs-keyword">in</span> node_object.intfList():
        <span class="hljs-keyword">print</span> node,intf,node_object.MAC(intf)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">set_route</span><span class="hljs-params">(net, fromnode, prefix, nextnode)</span>:</span>
    node_object = net.get(fromnode)
    ilist = node_object.connectionsTo(net.get(nextnode))
    node_object.setDefaultRoute(ilist[<span class="hljs-number">0</span>][<span class="hljs-number">0</span>])

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">setup_addressing</span><span class="hljs-params">(net)</span>:</span>
    reset_macs(net, <span class="hljs-string">&apos;server1&apos;</span>, <span class="hljs-string">&apos;10:00:00:00:00:{:02x}&apos;</span>)
    reset_macs(net, <span class="hljs-string">&apos;server2&apos;</span>, <span class="hljs-string">&apos;20:00:00:00:00:{:02x}&apos;</span>)
    reset_macs(net, <span class="hljs-string">&apos;client&apos;</span>, <span class="hljs-string">&apos;30:00:00:00:00:{:02x}&apos;</span>)
    reset_macs(net, <span class="hljs-string">&apos;hub&apos;</span>, <span class="hljs-string">&apos;40:00:00:00:00:{:02x}&apos;</span>)
    set_ip(net, <span class="hljs-string">&apos;server1&apos;</span>,<span class="hljs-string">&apos;hub&apos;</span>,<span class="hljs-string">&apos;192.168.100.1/24&apos;</span>)
    set_ip(net, <span class="hljs-string">&apos;server2&apos;</span>,<span class="hljs-string">&apos;hub&apos;</span>,<span class="hljs-string">&apos;192.168.100.2/24&apos;</span>)
    set_ip(net, <span class="hljs-string">&apos;client&apos;</span>,<span class="hljs-string">&apos;hub&apos;</span>,<span class="hljs-string">&apos;192.168.100.3/24&apos;</span>)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">disable_ipv6</span><span class="hljs-params">(net)</span>:</span>
    <span class="hljs-keyword">for</span> v <span class="hljs-keyword">in</span> net.values():
        v.cmdPrint(<span class="hljs-string">&apos;sysctl -w net.ipv6.conf.all.disable_ipv6=1&apos;</span>)
        v.cmdPrint(<span class="hljs-string">&apos;sysctl -w net.ipv6.conf.default.disable_ipv6=1&apos;</span>)

<span class="hljs-function"><span class="hljs-keyword">def</span> <span class="hljs-title">main</span><span class="hljs-params">()</span>:</span>
    topo = PySwitchTopo(args)
    net = Mininet(controller=<span class="hljs-keyword">None</span>, topo=topo, link=TCLink, cleanup=<span class="hljs-keyword">True</span>)
    setup_addressing(net)
    disable_ipv6(net)
    net.interact()

<span class="hljs-keyword">if</span> __name__ == <span class="hljs-string">&apos;__main__&apos;</span>:
    main()
</code></pre>
<p>We build a topology inside the constructor function <code>__init__</code> of class <code>PySwitchTopo</code>. If you want to change the topology, you should modify it. We setup interfaces in the function <code>setup_addressing</code>, you will learn what happens here after knowing Ethernet and IP protocol.</p>
<p>In general, you don&apos;t need to modify the topology file we provide. But if you do, you need the document <em><a href="https://github.com/mininet/mininet/wiki/Introduction-to-Mininet" target="_blank">Introduction to Mininet</a></em> which gives you the Mininet Python API.</p>
<p>Please read it carefully. Then let&apos;s start this topology.</p>
<pre><code>$ sudo python examples/start_mininet.py
</code></pre><p>In this topology, hosts can not <code>ping</code> each other because the device named <code>hub</code> has no routing rules configured, so exit here. In the section of Switchyard, we will make it work.</p>
<blockquote>
<p>[!NOTE]
Mininet topology scripts are written in Python 2.</p>
</blockquote>

<script>console.log("plugin-popup....");document.onclick = function(e){ e.target.tagName === "IMG" && window.open(e.target.src,e.target.src)}</script><style>img{cursor:pointer}</style>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="vscode.html" class="navigation navigation-prev " aria-label="Previous page: VS Code">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="wireshark.html" class="navigation navigation-next " aria-label="Next page: Wireshark">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"Mininet","level":"1.2.2.2","depth":3,"next":{"title":"Wireshark","level":"1.2.2.3","depth":3,"path":"content/ch01/wireshark.md","ref":"content/ch01/wireshark.md","articles":[]},"previous":{"title":"VS Code","level":"1.2.2.1","depth":3,"path":"content/ch01/vscode.md","ref":"content/ch01/vscode.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":["theme-comscore","back-to-top-button","-lunr","-search","search-pro","github","splitter","flexible-alerts","page-toc-button","auto-scroll-table","popup","anchors"],"pluginsConfig":{"styles":{"website":"styles/website.css"},"github":{"url":"https://github.com/shellqiqi/nju-network-experiments"},"splitter":{},"search-pro":{},"auto-scroll-table":{},"popup":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"theme-comscore":{},"page-toc-button":{},"back-to-top-button":{},"flexible-alerts":{"danger":{"className":"danger","icon":"fa fa-ban","label":"Attention"},"note":{"className":"info","icon":"fa fa-info-circle","label":"Note"},"style":"callout","tip":{"className":"tip","icon":"fa fa-lightbulb-o","label":"Tip"},"warning":{"className":"warning","icon":"fa fa-exclamation-triangle","label":"Warning"}},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"content/ch01/mininet.md","mtime":"2020-03-24T11:10:36.703Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-24T13:21:20.286Z"},"basePath":"../..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../../gitbook/gitbook.js"></script>
    <script src="../../gitbook/theme.js"></script>
    
        
        <script src="../../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/jquery.mark.min.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-search-pro/search.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-flexible-alerts/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

